<?php

/**
 * CompraEspecial form.
 *
 * @package    dirsac
 * @subpackage form
 * @author     Miguel Flores
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class CompraEspecialForm extends BaseCompraEspecialForm
{
  public function configure()
  {
	  unset($this['created_at'], $this['updated_at']);
	  
	  $this->widgetSchema['plazo_entrega'] = new sfWidgetFormInputText();
		$this->widgetSchema['plazo_entrega']->setAttribute('class', 'datepicker');
	  
	  $this->widgetSchema['neto'] ->setAttribute('id', 'neto_txt');
	  $this->widgetSchema['neto'] ->setAttribute('onkeyup','actualiza();');
	  $this->widgetSchema['iva'] ->setAttribute('id', 'iva_txt');
	  $this->widgetSchema['iva'] ->setAttribute('readonly', 'true');
	  $this->widgetSchema['total'] ->setAttribute('id', 'total_txt');
	  $this->widgetSchema['total'] ->setAttribute('readonly', 'true');
	  $this->widgetSchema['estado'] ->setAttribute('type', 'hidden');
  	$this->widgetSchema['cotizacion'] = new sfWidgetFormInputFileEditable(array(
      'label'     => 'Cotización',
      'file_src'  => '/uploads/cespeciales/'.$this->getObject()->getCotizacion(),
      'is_image'  => false,
      'edit_mode' => !$this->isNew(),
      'template'  => '<div><a href="%file%">ver cotización</a><br /><label></label>%input%<br /><label></label>%delete% Eliminar archivo actual</div>',
    ));
    
    $this->validatorSchema['cotizacion'] = new sfValidatorFile(array(
      'required' => false,
      'path'     => sfConfig::get('sf_upload_dir').'/cespeciales',
      'max_size' => '20971520'
    ));
    
    
  }
}
